<template>
	<view class="messageReturn">
		<view class="area-title">反馈内容</view>
		<view class="message_input"><textarea v-model="messageObj.content" placeholder="提供更多信息助于我们快速处理"></textarea></view>
		<view class="area-title">反馈照片</view>
		<view class="upload_img_list"><uploadImage :maxCount="9" @success="uploadSuccess"></uploadImage></view>
		<view class="yellow_btn" @tap="submitMessage">确定</view>
	</view>
</template>

<script>
import uploadImage from '../../components/uploadImage/uploadImage.vue';
export default {
	components: {
		uploadImage
	},
	data() {
		return {
			qiniuUrl: 'http://qiniu.zhinh.cn/',
			messageObj: {
				content: '',
				images: ''
			}
		};
	},
	methods: {
		uploadSuccess(val) {
			this.messageObj.images = val.map(item => this.qiniuUrl + item.url) + '';
			console.log(val, this.messageObj.images, '上传图片');
		},
		submitMessage() {
			console.log(this.messageObj, '提交');
			this.$api.suggestion(this.messageObj).then(res => {
				if (res.code == 1) {
					this.$helper.toast(res.msg);
					setTimeout(() => {
						uni.navigateBack();
					}, 800);
				}
			});
		}
	}
};
</script>

<style lang="scss">
.messageReturn {
	background: #ffffff;
	min-height: 100vh;
	padding: 24rpx;
	box-sizing: border-box;
	.message_input {
		height: 267rpx;
		box-sizing: border-box;
		background: #f9f9f9;
		border-radius: 10rpx;
		padding: 20rpx 26rpx;
		margin-bottom: 40rpx;
		textarea {
			color: #999999;
			font-size: 28rpx;
		}
	}
	.upload_img_list {
		margin-bottom: 282rpx;
	}
}
</style>
